<!DOCTYPE html>
<html lang="en">
<head>
    <title>WSD Admin</title>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="stylesheet" href="__STATICURL__/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="__STATICURL__/css/bootstrap-responsive.min.css"/>
    <link rel="stylesheet" href="__STATICURL__/css/uniform.css"/>
    <link rel="stylesheet" href="__STATICURL__/css/select2.css"/>
    <link rel="stylesheet" href="__STATICURL__/css/matrix-style.css"/>
    <link rel="stylesheet" href="__STATICURL__/css/matrix-media.css"/>
    <link rel="stylesheet" href="__STATICURL__/css/bootstrap-wysihtml5.css"/>
    <link href="__STATICURL__/font-awesome/css/font-awesome.css" rel="stylesheet"/>
</head>
<body>
<include file="Common:header"/>
<div id="content">
    <!--breadcrumbs-->
    <div id="content-header">
        <div id="breadcrumb"><a href="__ROOT__/clover"><i class="icon-home"></i> 主页</a><a href="#"
                                                                                          class="current">职位列表</a></div>
    </div>
    <!--End-breadcrumbs-->
    <div class="container-fluid">
        <div style="margin:5px;" data-toggle="buttons-radio" class="btn-group">
            <a class="btn btn-primary <if condition=" ($is_publish neq 2)">active</if>"
            href="__URL__?is_publish=1">发布中</a>
            <a class="btn btn-primary <if condition=" ($is_publish eq 2)">active</if>"
            href="__URL__?is_publish=2">未发布</a>
        </div>
        <a style="float:right;" href="__URL__/add_job" class=" btn-icon-pg">
            <ul>
                <li><i class="icon-plus"></i>添加招聘职位</li>
            </ul>
        </a>

        <div class="row-fluid">
            <div class="span12">
                <div class="widget-box" style="margin-top:0px;">
                    <div class="widget-title"><span class="icon"> <i class="icon-th"></i> </span>
                        <h5>招聘列表</h5>
                    </div>
                    <div class="widget-content nopadding">
                        <ul class="recent-posts">
                            <notempty name="jobs_list">
                                <foreach name="{jobs_list}" item="vo" key="k">
                                    <li class="li_{$vo.id}" style="height:30px;overflow: hidden;">
                                        <div style="float:left;height:25px;width:35px;line-height:25px;padding-top:8px;">
                                            <span class="badge">{$k+1}</span></div>
                                        <div class="article-post">
                                            <div class="fr"><a href="__URL__ /edit_job?id={$vo.id}"
                                                               class="btn btn-primary btn-mini">编辑</a> <a href="#"
                                                                                                          class="btn btn-success btn-mini js_on_publish"
                                                                                                          data-id="{$vo.id}"
                                                                                                          data-status="{$vo.is_publish}">
                                                <if condition="($vo.is_publish eq 2)">发布
                                                    <else/>
                                                    下线
                                                </if>
                                            </a> <a href="javascript:void(0);" class="btn btn-danger btn-mini J_delete"
                                                    data-value="{$vo.id}">删除</a></div>
                                            <span class="user-info"> <b>{$vo.job_name}</b> /招聘{$vo.num}人/ 发布日期:{$vo.add_time|date="Y-m-d",###} </span>

                                            <p><a href="__URL__ /edit_job?id={$vo.id}">{$vo.job_intro|strip_tags}</a>
                                            </p>
                                        </div>
                                    </li>
                                </foreach>
                                <li>
                                </li>
                                <else/>
                                <li> 暂无数据……</li>
                            </notempty>
                        </ul>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
<!--Footer-part-->
<include file="Common:footer"/>
<!--end-Footer-part-->
<script src="__STATICURL__/js/jquery.min.js"></script>
<script src="__STATICURL__/js/jquery.ui.custom.js"></script>
<script src="__STATICURL__/js/bootstrap.min.js"></script>
<script src="__STATICURL__/js/jquery.uniform.js"></script>
<script src="__STATICURL__/js/select2.min.js"></script>
<script src="__STATICURL__/js/jquery.dataTables.min.js"></script>
<script src="__STATICURL__/js/matrix.js"></script>
<script src="__STATICURL__/js/matrix.tables.js"></script>
</body>
</html>
<script type="text/javascript">
    $(document).ready(function ($) {
        $("#J_select_type").change(function () {
            var cat_id = $(this).val();
            window.location.href = "__URL__/index/cat_id/" + cat_id;
        });
        $(".J_delete").click(function (event) {
            var id = $(this).attr("data-value");
            if (confirm("确定要删除吗？") == true) {
                $.post('__URL__/do_delete', {id: id}, function (res) {
                    if (res) {
                        $(".li_" + id).fadeOut("slow");
                    } else {
                        alert("删除失败");
                    }
                });
            }
        });
        $(".js_on_publish").click(function () {
            var job_id = $(this).attr("data-id");
            var status = $(this).attr("data-status");
            var detail = '下线';
            if (status == 2) {
                detail = '发布';
            }
            if (confirm("您确定 " + detail + " 这个职位吗?")) {
                $.post("__URL__/on_publish", {job_id: job_id}, function (data) {
                    if (data.status) {
                        window.location.href = "__URL__";
                    } else {
                        window.location.href = "__URL__";
                    }
                }, "json");
            } else {
                return false;
            }
        });
    });
</script>
